package com.woniuxy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.mapper.SysLogOptMapper;
import com.woniuxy.pojo.SysLogOpt;
import com.woniuxy.service.SysLogOptService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
* @author Administrator
* @description 针对表【t_sys_log_opt(操作日志表)】的数据库操作Service实现
* @createDate 2025-06-09 20:13:55
*/
@Service
public class SysLogOptServiceImpl extends ServiceImpl<SysLogOptMapper, SysLogOpt>
    implements SysLogOptService {
    @Override
    public int removeLogsBefore(LocalDateTime deadline) {
        QueryWrapper<SysLogOpt> wrapper = new QueryWrapper<>();
        wrapper.lt("opt_time", deadline);

        boolean result = this.remove(wrapper); // remove 返回 boolean，只能知道是否成功

        return result ? 1 : 0;
    }
}




